<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>6.3jQuery基础-常用函数</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<style>
  .m-main{
    height: 500px;
    border: 1px solid red;
  }
  .m-move{
    width: 100px;
    height: 100px;
    background: #ff8899;
  }
</style>
<body>
  <div class="m-main">
    <div class="m-move"></div>
  </div>
  <script>
    // 当文档加载完成后执行
    $(document).ready(function(){
      var moveDom = $('.m-move')
      moveDom.animate({
        width: '50%',
        height: '300px',
        marginLeft: '400px'
      },2000,function(){
        console.log('动画执行完-回调')
        //moveDom.width("100px")
        moveDom.css({
          background: 'yellow'
        })
      })
    })
  </script>

</body>
</html>